package com.example.intelligenttransportationteam1;

import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class RegisterActivity extends AppCompatActivity {

    private EditText edtMainUser2;
    private EditText edtMainPsw2;
    private EditText edtMainUser2Again;
    private EditText edtMainPhone;
    private Button btnMainCancel;
    private Button btnMainRegister;
    private TextView tvMainSetting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        initView();
        btnMainCancel.setOnClickListener(v -> finish());
    }

    private void initView() {
        edtMainUser2 = (EditText) findViewById(R.id.edt_main_user2);
        edtMainPsw2 = (EditText) findViewById(R.id.edt_main_psw2);
        edtMainUser2Again = (EditText) findViewById(R.id.edt_main_user2_again);
        edtMainPhone = (EditText) findViewById(R.id.edt_main_phone);
        btnMainCancel = (Button) findViewById(R.id.btn_main_cancel);
        btnMainRegister = (Button) findViewById(R.id.btn_main_register);
        tvMainSetting = (TextView) findViewById(R.id.tv_main_setting);
    }


    public void OnSetting(View view) {
        netsettingDialog();
    }

    public void netsettingDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
        View view = LayoutInflater.from(RegisterActivity.this).inflate(R.layout.activity_net_setting, null, false);
        builder.setView(view);
        Dialog dialog = builder.create();
        EditText edtIP = view.findViewById(R.id.edtNsdialogAdress);
        EditText edtPort = view.findViewById(R.id.edtNsdialogPws);
        Button btnSave = view.findViewById(R.id.btnNsdialogSave);
        Button btnCancel = view.findViewById(R.id.btnNsdialogCancle);
        btnSave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();


    }
}